Ethertype is a field in an ethereframe. It is used to specify the Protocol applied to the frame data field. According to 802.3, the length/ethertype field is a field of two eight character segments. The meaning of the two is one, depending on the value. In quantitative evaluation, the first eight-byte field is the most important. When the field value is greater than or equal to the decimal value 1536 (that
protocol (Dial Up/Modem ):576 bytesPoint-to-Point:4470 bytesIf the IP layer needs to transmit a datagram larger than the MTU of the link layer, the IP layer will split the datagram. A datagram is divided into several parts. The size of each part is smaller than or equal to the MTU value of the link layer. When hosts on the same network communicate with each other, the MTU of the network is very important to both parties. However, when a host can communicate through many networks, the most impor
Ethertype: Ethernet Type field and ValueEthertype is a field in an ethereframe. It is used to specify the Protocol applied to the frame data field. According to 802.3, the length/ethertype field is a field of two eight character segments. The meaning of the two is one, depending on the value. In quantitative evaluation, the first eight-byte field is the most important. When the field value is greater than o
/s1# IP netns exec MySpace route-nkernel IP Routing tabledestination Gateway genmask Flags Metric Ref use Iface0.0.0.0 192.168.45.2 0.0.0.0Ug0 0 0veth2192.168.45.0 0.0.0.0 255.255.255.0U0 0 0Veth2The first one is explicitly created, and the second is automatically created.Now you can ping the address of the extranet from MySpace.2 Principle 2.1 about eighth article SNATIf no eighth SNAT is set, the ICMP Request can reach the other computer, but the E
is used to verify frames. If the verification fails, it is discarded, only qualified data frames are received by the NIC, so CRC fields are not managed. Therefore, the key to parsing Ethernet data frames is to obtain the type field, and then submit the data of the data field to the upper-layer protocol for Processing Based on the Type field. Save the destination MAC address and source MAC address for subsequent use.
According to 802.3, the Ethernet Type field (
destination IP address is not changed or VIP, if this VIP address is not configured on the realserver, the packet will be discarded directly. therefore, you must configure a VIP with a 32 mask on the realserver, as shown below:
ifconfig lo:1 VIP netmask 255.255.255.0 up
However, when someone asks who's IP address is 192.168.81.229, both network adapters say that I am my network adapter. who should I send it?FirstNow, see the figure:
#tcpdump -e -nn host 192.168.81.229tcpdump: verbose output sup
255.255.255.0 up
However, when someone asks who's IP address is 192.168.81.229, both network adapters say that I am my network adapter. who should I send it?FirstNow, see the figure:
#tcpdump -e -nn host 192.168.81.229tcpdump: verbose output suppressed, use -v or -vv for full protocol decodelistening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes22:27:50.720431 00:50:56:92:05:b9 > ff:ff:ff:ff:ff:ff, ethertype ARP (0x0806), length 42: arp
)//-------------------------------------------------------------------------Void packetchecksum (unsigned char packet []){Dlc_header * pdlc_header = NULL; // Ethernet header pointerIp_header? * Pip_header = NULL ;? // IP header pointerUnsigned short attachsize = 0; // The total length of the transport layer protocol header and additional data
? Pdlc_header = (dlc_header *) packet;
? // Determine the ethertype. If it is not an IP package, it will not b
will know ^_^ ).
DLC Header
Field
Length (byte)
Fill Value
Receiver Mac
6
Ffffffffff
Sender MAC
6
Aaaaaaaaaaaa
Ethertype
2
Zero X 0806
Figure 3 the content of the DLC header in the ARP request packet follows the ARP frame.
Operation CodeOf course it is 1,
Sender's MacAnd
IPOf course fill in our own, and pay attention to, here's
Receiver IP AddressFill in the IP address we want
"001636" for the hardware device of the first three bytes ", the last three bytes are randomly generated. Source code location:
Dhcpstarv-0.2.1/src/main. c: 130 rows
Unsigned char vendor_mac_prefix [] = {0x00, 0x16, 0x36 };
However, the source MAC of the Ethernet frame is the real MAC of the NIC that sends the data frame. Therefore, to locate the source of the DHCP Request Packet forged by Dhcpstarv, you can capture packets, determine the location of Dhcpstarv based on the source MAC in the Et
Sender MAC6aaaaaaaaaaaa
Sender IP4192.168.0.1
Recipient mac6bbbbbbbbbbbbbb
Receiver IP4192.168.0.99
Fill data 180
Content of ARP frames in ARP response packets
In this way, the IP address ing about 192.168.0.1 will be added to the ARP cache of 192.168.0.99.
Now, it's time for programming to implement it. ^_^
Ii. Programming Implementation of ARP packet sending
1. fill data packets
The above tables about the various fields of the ARP packet correspond to the struct in the program, correspond
.
1
#tcpdump -n dst portrange 1-1023
Intercept all packet data between 1 and 1023 on the target port.
1
#tcpdump greater 20
Intercept all message data with a message length greater than 20.Basic format for output information:Although the tcpdump will vary depending on the specified parameters, the output may vary. But its basic output format is the same: the system time source host. Port > Destination host. Port packet parameters. L
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.